package operation.Jihe;

import java.util.TreeSet;

public class Demo02 {
    /*2.分析以下需求，并用代码实现：
	(1)定义一个员工类Employee，包含三个属性：姓名(String name)、年龄(int age)、工资(int salary)
	(2)创建5个对象装入TreeSet，按照工资从高到底排序输出结果(工资相同，按照年龄从低到高，工资和年龄都相同，
		按照姓名字典顺序排列)*/
    public static void main(String[] args) {
        TreeSet<Employee>ts=new TreeSet<Employee>();
        Employee e1=new Employee("laozhang",23,5000);
        Employee e2=new Employee("laoli",27,6000);
        Employee e3=new Employee("laohu",24,4000);
        Employee e4=new Employee("laoyang",21,7000);
        Employee e5=new Employee("laoxie",26,5000);
        ts.add(e1);
        ts.add(e2);
        ts.add(e3);
        ts.add(e4);
        ts.add(e5);

        for (Employee t : ts) {
            System.out.println(t);
        }

    }
}
